export default {
  data() {
    return {
      form: {
        title: "",
        contacts: "",
        contactNumber: "",
        experience: "",
        appealReason: "",
        financeName: "",
        financeTerm: "",
        financeType: "",
        financeMoney: "",
        financeBrief: "",
        financeFunds: "",
        financeRound: "",
        financeGurantee: "",
        financeStatus: "",
        financeExpect: "",
        financeLabel: [],
        financeChat: "",
        financeDescribe: "",
        appealFile: "",
        projectDetails: ""
      },
      rules: {
        title: [{ required: true, message: "请输入诉求名称", trigger: "blur" }],
        contacts: [
          { required: true, message: "请输入联系人", trigger: "blur" }
        ],
        contactNumber: [
          { 
            required: true, 
            trigger: "blur",
            validator: (rule, value, callback) => {
              if (!this.regCheck('empty', value)) {
                callback(new Error('请输入联系电话'));
              } else if (this.regCheck('phone', value)) {
                callback(new Error('请输入正确的联系电话'));
              } else {
                callback()
              }
            }
          }
        ],
        experience: [
          { required: true, message: "请选择金融类型", trigger: "change" }
        ],
        appealReason: [
          { required: true, message: "请输入诉求原因", trigger: "blur" }
        ],
        financeName: [
          { required: true, message: "请输入融资名称", trigger: "blur" }
        ],
        financeTerm: [
          { required: true, message: "请选择融资期限", trigger: "change" }
        ],
        financeType: [
          { required: true, message: "请选择融资类型", trigger: "change" }
        ],
        financeMoney: [
          { 
            required: true, 
            trigger: "blur",
            validator: (rule, value, callback) => {
              if (!this.regCheck('empty', value)) {
                callback(new Error('请输入融资金额'));
              } else if (this.regCheck('number', value)) {
                callback(new Error('请输入数字'));
              } else {
                callback()
              }
            },
          }
        ],
        financeBrief: [
          { required: true, message: "请输入简介", trigger: "blur" }
        ],
        financeFunds: [
          { required: true, message: "请输入资金用途", trigger: "blur" }
        ],
        financeRound: [
          { required: true, message: "请选择融资轮次", trigger: "change" }
        ],
        financeGurantee: [
          { required: true, message: "请输入担保方式", trigger: "blur" }
        ],
        financeStatus: [
          { required: true, message: "请选择公司财务状况", trigger: "change" }
        ],
        financeExpect: [
          { required: true, message: "请输入融资期望", trigger: "blur" }
        ],
        financeLabel: [
          {
            required: true,
            type: "array",
            trigger: ["blur", "change"],
            validator: (rule, value, callback) => {
              let msg = this.regCheck('tag', value)
              if(msg) {
                callback(msg)
              } else {
                callback()
              }
            },
          },
        ],
        projectDetails: [
          { required: true, message: "请输入详细描述", trigger: "blur" }
        ]
      },
    }
  }
}
